package com.hkj.shop.dao;

import java.util.List;

import org.hibernate.Session;
import org.springframework.stereotype.Repository;

import com.hkj.shop.base.dao.BaseDao;
import com.hkj.shop.model.User;

@Repository
public class UserDao extends BaseDao {
	public User query(long id) {
		Session session = null;
		User user = null;
		try {
		    session = this.getSession();
			user = (User) session.get(User.class, id);
		} catch (Exception e) {
		} finally {
			session.close();
		}
		return user;
	}

	public List<User> getByAccount(String account) {
		Session session = null;
		List<User> user = null;
		try {
			user = session.createQuery("from User u where u.account:account").setParameter("account", "admin").list();
		} catch (Exception e) {
		}
		return user;
	}
}
